全部文档

12标签

提供根据ID查询标签的功能

12.1根据资源id获取标签信息

功能描述:提供根据资源ID获取标签信息。

GET  /api/v1/tag/{resourceId}

Path:

Name Type Description Required
resourceId int 资源ID Yes

Query:

Name Type Description Required
tagType int 标签类型 1:产品标签, 2:设备标签, 3:分组标签, 4:节点标签 Yes

cURL example:

   curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/tag/{resourceId}?tagType=1&accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
   --header 'platform: 3' \
   --header 'projectId: {projectId}'

Response data:

Name Type Description
id int 标签ID
resourceId int 标签类型对应的资源ID
tagType int 标签类型 1:产品标签, 2:设备标签, 3:分组标签, 4:节点标签
tagKey string 标签key
tagValue string 标签value
created long 创建时间
modified long 修改时间

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
  "data": {
                  "id": 139,
                  "resourceId": 100234,
                  "tagType": 1,
                  "tagKey": "string",
                  "tagValue": "string",
                  "created": 1588821676143,
                  "modified": 1588821676143
              }
}

12.2 根据资源id创建标签信息

功能描述:提供物联网平台的资源ID创建标签信息。

PUT  /api/v1/tag

Body:

Name Type Description Required
list struct[] 标签列表 Yes

list的子对象结构体:

Name Type Description Required
resourceId int 标签类型对应的资源id(产品id, 设备id, 分组id) Yes
tagKey string 标签key Yes
tagType int 标签类型 1:产品标签, 2:设备标签, 3:分组标签,4:节点标签 Yes
tagValue string 标签value Yes

Body example:

[
  {
    "resourceId": 10011730,
    "tagKey": "string",
    "tagType": 2,
    "tagValue": "test"
  }
]

cURL example:

   curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/tag?tagType=1&accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
   --header 'platform: 3' \
   --header 'projectId: {projectId}' \
   --header 'Content-Type: application/json' \
   --data-raw '[
                 {
                   "resourceId": 10011730,
                   "tagKey": "string",
                   "tagType": 2,
                   "tagValue": "test"
                 }
               ]'

Response example:

{
  "success": true,
  "code": 0,
  "msg": null,
  "data": null
}

results matching ""

    No results matching ""